Previous Book Contents Book Index Next

Inside Macintosh: QuickTime /
Chapter 3 - Image Compression Manager / Image Compression Manager Reference
Image Compression Manager Functions / Working With Images


CompressImage

The CompressImage function allows your application to compress a single-frame image that is currently stored as a pixel map structure.

pascal OSErr CompressImage (PixMapHandle src, 
                           const  Rect *srcRect, 
                           CodecQ quality, CodecType cType,
                           ImageDescriptionHandle desc, 
                           Ptr data);
src
Contains a handle to the image to be compressed. The image must be stored in a pixel map structure.
srcRect
Contains a pointer to a rectangle defining the portion of the image to compress.
quality
Specifies the desired compressed image quality. See "Compression Quality Constants" on page 3-52 for valid values.
cType
Specifies a compressor type. You must set this parameter to a
valid compressor type (see Table 3-3 on page 3-59 for a list of the available compressor types).
desc
Contains a handle that is to receive a formatted image description structure. The Image Compression Manager resizes this handle for the returned image description structure. Your application should store this image description with the compressed image data.
data
Points to a location to receive the compressed image data. It is your program's responsibility to make sure that this location can receive at least as much data as indicated by the GetMaxCompressionSize function (described on page 3-63). The Image Compression Manager places the actual size of the compressed image into the dataSize field of the image description structure referred to by the desc parameter. This pointer must contain a 32-bit clean address. If you use a dereferenced, locked handle, you must call the Memory Manager's StripAddress routine before you use that handle with this parameter (for details on StripAddress, see Inside Macintosh: Memory).
DESCRIPTION
The CompressImage function presents a simplified interface to your application, eliminating some parameters for the sake of convenience.

RESULT CODES
noErr0No error
paramErr-50Invalid parameter specified
memFullErr-108Not enough memory available
noCodecErr-8961The Image Compression Manager could not find the specified compressor
SEE ALSO
If you need to exert greater control over the compression operation, use the FCompressImage function, described in the next section.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996